//package cn.sofwin.blog.servlet;
//
//import cn.sofwin.blog.entity.Article;
//import cn.sofwin.blog.utils.HttpHelper;
//import org.apache.commons.lang3.StringUtils;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//@WebServlet("/blog/article")
//public class ArticleShowServlet extends HttpServlet {
//
//    /** 文章服务接口 */
//    private ArticleService articleService = ArticleServiceImpl.getInstance();
//
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//
//        // 如果ID参数不为空，则代表要 修改指定的文章
//        String id = req.getParameter("id");
//        if(StringUtils.isNoneBlank(id)){
//            // 从数据库中查询文章信息
//            Article article = articleService.get(Integer.valueOf(id));
//            if(article.getStatus() == -1){
//                HttpHelper.error("文章已删除", req, resp);
//            }else{
//                // 添加到请求作用域
//                req.setAttribute("a", article);
//                // 更新文章阅读计数
//                articleService.addReadTotal(id);
//            }
//        }
//
//        // 转发到文章表单页面
//        req.getRequestDispatcher("/show.jsp").forward(req, resp);
//
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//
//    }
//}